<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2022/12/21
  Time: 15:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
    <title>联系人管理</title>
    <style>
        table
        {
            border-collapse:collapse;
        }
        table, tr, td
        {
            border: 2px solid darkblue;
            min-width: 60px;
            text-align: center;
        }
        /*布局参考：https://www.runoob.com/try/try.php?filename=trycss_website_layout_blog*/
    </style>
</head>
<body>
<h1>当前登陆用户：${sessionScope.user.name}</h1>&nbsp;&nbsp;&nbsp;&nbsp;<a href="/users/logout">登出系统</a>
<%--显示联系人列表--%>
<form action="/contacts/search" method="get">
    联系人查询（姓名）：<input type="text" name="name"> <input type="submit" value="查询">
</form>&nbsp;<a href="/contacts/add">新增联系人</a>
<table>
    <tr>
        <td>编号</td>
        <td>姓名</td>
        <td>地址</td>
        <td>手机</td>
        <td>操作</td>
    </tr>
    <c:forEach var="contact" items="${contacts}">
    <tr>
        <td>${contact.id}</td>
        <td>${contact.name}</td>
        <td>${contact.address}</td>
        <td>${contact.mobile}</td>
        <td>
            <a href="/contacts/edit/${contact.id}">编辑</a>&nbsp;&nbsp;
            <a href="/contacts/del?id=${contact.id}">删除</a>
        </td>
    </tr>
    </c:forEach>
</table>
</body>
</html>
